package com.acyouzi.leetcode.tree;

/**
 * Created by SUN on 2017/9/6.
 */
class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;
    TreeNode(int x) { val = x; }
}
public class InvertBinaryTree {
  public TreeNode invertTree(TreeNode root) {
    if (root == null) return null;
    invertTree(root.left);
    invertTree(root.right);
    TreeNode tmp = root.left;
    root.left = root.right;
    root.right = tmp;
    return root;
  }
}
